package com.ts.enterprise.module.user.dao;


import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.ts.enterprise.module.user.entity.WorkerTag;
import com.ts.enterprise.module.user.mapper.WorkerMapper;
import com.ts.enterprise.module.user.service.WorkerTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 *
 * @author dean
 * @date 2021-07-14 11:05:56
 */
@Service
public class WorkerDao {

    @Autowired
    private WorkerMapper workerMapper;

    @Autowired
    private WorkerTagService workerTagService;

    @Transactional(rollbackFor = Exception.class)
    public void saveLock(List<WorkerTag> saveList, List<WorkerTag> updateList) {
        if (CollectionUtils.isNotEmpty(saveList)){
            workerTagService.saveBatch(saveList);
        }
        if (CollectionUtils.isNotEmpty(updateList)){
            workerTagService.saveBatch(updateList);
        }

    }
}
